﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HslCommunication.BasicFramework;
using HslCommunication.Core;
using HslCommunication.Core.IMessage;
using HslCommunication.Core.Net;
using HslCommunication.Reflection;

namespace HslCommunication.Profinet.AllenBradley
{
	/// <summary>
	/// AB PLC的数据通信类，使用CIP协议实现，适用1756，1769等型号，支持使用标签的形式进行读写操作，支持标量数据，一维数组，二维数组，三维数组等等。如果是局部变量，那么使用 Program:MainProgram.[变量名]。<br />
	/// The data communication class of AB PLC is implemented using the CIP protocol. It is suitable for 1756, 1769 and other models. 
	/// It supports reading and writing in the form of tags, scalar data, one-dimensional array, two-dimensional array, 
	/// three-dimensional array, and so on. If it is a local variable, use the Program:MainProgram.[Variable name].
	/// </summary>
	/// <remarks>
	/// thanks 江阴-  ∮溪风-⊙_⌒ help test the dll
	/// <br />
	/// thanks 上海-null 测试了这个dll
	/// <br />
	/// <br />
	/// 默认的地址就是PLC里的TAG名字，比如A，B，C；如果你需要读取的数据是一个数组，那么A就是默认的A[0]，如果想要读取偏移量为10的数据，那么地址为A[10]，
	/// 多维数组同理，使用A[10,10,10]的操作。
	/// <br />
	/// <br />
	/// 假设你读取的是局部变量，那么使用 Program:MainProgram.变量名<br />
	/// 目前适用的系列为1756 ControlLogix, 1756 GuardLogix, 1769 CompactLogix, 1769 Compact GuardLogix, 1789SoftLogix, 5069 CompactLogix, 5069 Compact GuardLogix, Studio 5000 Logix Emulate
	/// <br />
	/// <br />
	/// 如果你有个Bool数组要读取，变量名为 A, 那么读第0个位，可以通过 ReadBool("A")，但是第二个位需要使用<br />
	/// ReadBoolArray("A[0]")   // 返回32个bool长度，0-31的索引，如果我想读取32-63的位索引，就需要 ReadBoolArray("A[1]") ，以此类推。
	/// <br />
	/// <br />
	/// 地址可以携带站号信息，只要在前面加上slot=2;即可，这就是访问站号2的数据了，例如 slot=2;AAA
	/// </remarks>
	// Token: 0x020000B9 RID: 185
	public class AllenBradleyNet : NetworkDeviceBase
	{
		/// <summary>
		/// Instantiate a communication object for a Allenbradley PLC protocol
		/// </summary>
		// Token: 0x06000D54 RID: 3412 RVA: 0x0004F255 File Offset: 0x0004D455
		public AllenBradleyNet()
		{
			base.WordLength = 2;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <summary>
		/// Instantiate a communication object for a Allenbradley PLC protocol
		/// </summary>
		/// <param name="ipAddress">PLC IpAddress</param>
		/// <param name="port">PLC Port</param>
		// Token: 0x06000D55 RID: 3413 RVA: 0x0004F282 File Offset: 0x0004D482
		public AllenBradleyNet(string ipAddress, int port = 44818)
		{
			base.WordLength = 2;
			this.IpAddress = ipAddress;
			this.Port = port;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <inheritdoc />
		// Token: 0x06000D56 RID: 3414 RVA: 0x000256D3 File Offset: 0x000238D3
		protected override INetMessage GetNewNetMessage()
		{
			return new AllenBradleyMessage();
		}

		/// <inheritdoc />
		// Token: 0x06000D57 RID: 3415 RVA: 0x0004F2C0 File Offset: 0x0004D4C0
		protected override byte[] PackCommandWithHeader(byte[] command)
		{
			return AllenBradleyHelper.PackRequestHeader(this.CipCommand, this.SessionHandle, command);
		}

		/// <summary>
		/// The current session handle, which is determined by the PLC when communicating with the PLC handshake
		/// </summary>
		// Token: 0x17000201 RID: 513
		// (get) Token: 0x06000D58 RID: 3416 RVA: 0x0004F2E4 File Offset: 0x0004D4E4
		// (set) Token: 0x06000D59 RID: 3417 RVA: 0x0004F2EC File Offset: 0x0004D4EC
		public uint SessionHandle { get; protected set; }

		/// <summary>
		/// Gets or sets the slot number information for the current plc, which should be set before connections
		/// </summary>
		// Token: 0x17000202 RID: 514
		// (get) Token: 0x06000D5A RID: 3418 RVA: 0x0004F2F5 File Offset: 0x0004D4F5
		// (set) Token: 0x06000D5B RID: 3419 RVA: 0x0004F2FD File Offset: 0x0004D4FD
		public byte Slot { get; set; } = 0;

		/// <summary>
		/// port and slot information
		/// </summary>
		// Token: 0x17000203 RID: 515
		// (get) Token: 0x06000D5C RID: 3420 RVA: 0x0004F306 File Offset: 0x0004D506
		// (set) Token: 0x06000D5D RID: 3421 RVA: 0x0004F30E File Offset: 0x0004D50E
		public byte[] PortSlot { get; set; }

		/// <summary>
		/// 获取或设置整个交互指令的控制码，默认为0x6F，通常不需要修改<br />
		/// Gets or sets the control code of the entire interactive instruction. The default is 0x6F, and usually does not need to be modified.
		/// </summary>
		// Token: 0x17000204 RID: 516
		// (get) Token: 0x06000D5E RID: 3422 RVA: 0x0004F317 File Offset: 0x0004D517
		// (set) Token: 0x06000D5F RID: 3423 RVA: 0x0004F31F File Offset: 0x0004D51F
		public ushort CipCommand { get; set; } = 111;

		/// <inheritdoc />
		// Token: 0x06000D60 RID: 3424 RVA: 0x0004F328 File Offset: 0x0004D528
		protected override OperateResult InitializationOnConnect(Socket socket)
		{
			OperateResult<byte[]> operateResult = this.ReadFromCoreServer(socket, AllenBradleyHelper.RegisterSessionHandle(), true, false);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = AllenBradleyHelper.CheckResponse(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					this.SessionHandle = base.ByteTransform.TransUInt32(operateResult.Content, 4);
					result = OperateResult.CreateSuccessResult();
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x06000D61 RID: 3425 RVA: 0x0004F398 File Offset: 0x0004D598
		protected override OperateResult ExtraOnDisconnect(Socket socket)
		{
			OperateResult<byte[]> operateResult = this.ReadFromCoreServer(socket, AllenBradleyHelper.UnRegisterSessionHandle(this.SessionHandle), true, false);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				result = OperateResult.CreateSuccessResult();
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x06000D62 RID: 3426 RVA: 0x0004F3D8 File Offset: 0x0004D5D8
		[DebuggerStepThrough]
		protected override Task<OperateResult> InitializationOnConnectAsync(Socket socket)
		{
			AllenBradleyNet.<InitializationOnConnectAsync>d__22 <InitializationOnConnectAsync>d__ = new AllenBradleyNet.<InitializationOnConnectAsync>d__22();
			<InitializationOnConnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<InitializationOnConnectAsync>d__.<>4__this = this;
			<InitializationOnConnectAsync>d__.socket = socket;
			<InitializationOnConnectAsync>d__.<>1__state = -1;
			<InitializationOnConnectAsync>d__.<>t__builder.Start<AllenBradleyNet.<InitializationOnConnectAsync>d__22>(ref <InitializationOnConnectAsync>d__);
			return <InitializationOnConnectAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D63 RID: 3427 RVA: 0x0004F424 File Offset: 0x0004D624
		[DebuggerStepThrough]
		protected override Task<OperateResult> ExtraOnDisconnectAsync(Socket socket)
		{
			AllenBradleyNet.<ExtraOnDisconnectAsync>d__23 <ExtraOnDisconnectAsync>d__ = new AllenBradleyNet.<ExtraOnDisconnectAsync>d__23();
			<ExtraOnDisconnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<ExtraOnDisconnectAsync>d__.<>4__this = this;
			<ExtraOnDisconnectAsync>d__.socket = socket;
			<ExtraOnDisconnectAsync>d__.<>1__state = -1;
			<ExtraOnDisconnectAsync>d__.<>t__builder.Start<AllenBradleyNet.<ExtraOnDisconnectAsync>d__23>(ref <ExtraOnDisconnectAsync>d__);
			return <ExtraOnDisconnectAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 创建一个读取标签的报文指定，标签地址可以手动动态指定slot编号，例如 slot=2;AAA<br />
		/// Build a read command bytes, The label address can manually specify the slot number dynamically, for example slot=2;AAA
		/// </summary>
		/// <param name="address">the address of the tag name</param>
		/// <param name="length">Array information, if not arrays, is 1 </param>
		/// <returns>Message information that contains the result object </returns>
		// Token: 0x06000D64 RID: 3428 RVA: 0x0004F470 File Offset: 0x0004D670
		public virtual OperateResult<byte[]> BuildReadCommand(string[] address, int[] length)
		{
			bool flag = address == null || length == null;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>("address or length is null");
			}
			else
			{
				bool flag2 = address.Length != length.Length;
				if (flag2)
				{
					result = new OperateResult<byte[]>("address and length is not same array");
				}
				else
				{
					try
					{
						byte b = this.Slot;
						List<byte[]> list = new List<byte[]>();
						for (int i = 0; i < address.Length; i++)
						{
							b = (byte)HslHelper.ExtractParameter(ref address[i], "slot", (int)this.Slot);
							list.Add(AllenBradleyHelper.PackRequsetRead(address[i], length[i], false));
						}
						byte[][] array = new byte[2][];
						array[0] = new byte[4];
						int num = 1;
						byte[] portSlot;
						if ((portSlot = this.PortSlot) == null)
						{
							byte[] array2 = new byte[2];
							array2[0] = 1;
							portSlot = array2;
							array2[1] = b;
						}
						array[num] = this.PackCommandService(portSlot, list.ToArray());
						byte[] value = AllenBradleyHelper.PackCommandSpecificData(array);
						result = OperateResult.CreateSuccessResult<byte[]>(value);
					}
					catch (Exception ex)
					{
						result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 创建一个读取多标签的报文<br />
		/// Build a read command bytes
		/// </summary>
		/// <param name="address">The address of the tag name </param>
		/// <returns>Message information that contains the result object </returns>
		// Token: 0x06000D65 RID: 3429 RVA: 0x0004F58C File Offset: 0x0004D78C
		public OperateResult<byte[]> BuildReadCommand(string[] address)
		{
			bool flag = address == null;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>("address or length is null");
			}
			else
			{
				int[] array = new int[address.Length];
				for (int i = 0; i < address.Length; i++)
				{
					array[i] = 1;
				}
				result = this.BuildReadCommand(address, array);
			}
			return result;
		}

		/// <summary>
		/// Create a written message instruction
		/// </summary>
		/// <param name="address">The address of the tag name </param>
		/// <param name="typeCode">Data type</param>
		/// <param name="data">Source Data </param>
		/// <param name="length">In the case of arrays, the length of the array </param>
		/// <returns>Message information that contains the result object</returns>
		// Token: 0x06000D66 RID: 3430 RVA: 0x0004F5E0 File Offset: 0x0004D7E0
		public OperateResult<byte[]> BuildWriteCommand(string address, ushort typeCode, byte[] data, int length = 1)
		{
			OperateResult<byte[]> result;
			try
			{
				byte b = (byte)HslHelper.ExtractParameter(ref address, "slot", (int)this.Slot);
				byte[] array = AllenBradleyHelper.PackRequestWrite(address, typeCode, data, length, false);
				byte[][] array2 = new byte[2][];
				array2[0] = new byte[4];
				int num = 1;
				byte[] portSlot;
				if ((portSlot = this.PortSlot) == null)
				{
					byte[] array3 = new byte[2];
					array3[0] = 1;
					portSlot = array3;
					array3[1] = b;
				}
				array2[num] = this.PackCommandService(portSlot, new byte[][]
				{
					array
				});
				byte[] value = AllenBradleyHelper.PackCommandSpecificData(array2);
				result = OperateResult.CreateSuccessResult<byte[]>(value);
			}
			catch (Exception ex)
			{
				result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
			}
			return result;
		}

		/// <summary>
		/// Create a written message instruction
		/// </summary>
		/// <param name="address">The address of the tag name </param>
		/// <param name="data">Bool Data </param>
		/// <returns>Message information that contains the result object</returns>
		// Token: 0x06000D67 RID: 3431 RVA: 0x0004F688 File Offset: 0x0004D888
		public OperateResult<byte[]> BuildWriteCommand(string address, bool data)
		{
			OperateResult<byte[]> result;
			try
			{
				byte b = (byte)HslHelper.ExtractParameter(ref address, "slot", (int)this.Slot);
				byte[] array = AllenBradleyHelper.PackRequestWrite(address, data);
				byte[][] array2 = new byte[2][];
				array2[0] = new byte[4];
				int num = 1;
				byte[] portSlot;
				if ((portSlot = this.PortSlot) == null)
				{
					byte[] array3 = new byte[2];
					array3[0] = 1;
					portSlot = array3;
					array3[1] = b;
				}
				array2[num] = this.PackCommandService(portSlot, new byte[][]
				{
					array
				});
				byte[] value = AllenBradleyHelper.PackCommandSpecificData(array2);
				result = OperateResult.CreateSuccessResult<byte[]>(value);
			}
			catch (Exception ex)
			{
				result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
			}
			return result;
		}

		/// <summary>
		/// Read data information, data length for read array length information
		/// </summary>
		/// <param name="address">Address format of the node</param>
		/// <param name="length">In the case of arrays, the length of the array </param>
		/// <returns>Result data with result object </returns>
		// Token: 0x06000D68 RID: 3432 RVA: 0x0004F72C File Offset: 0x0004D92C
		[HslMqttApi("ReadByteArray", "")]
		public override OperateResult<byte[]> Read(string address, ushort length)
		{
			bool flag = length > 1;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = this.ReadSegment(address, 0, (int)length);
			}
			else
			{
				result = this.Read(new string[]
				{
					address
				}, new int[]
				{
					(int)length
				});
			}
			return result;
		}

		/// <summary>
		/// Bulk read Data information
		/// </summary>
		/// <param name="address">Name of the node </param>
		/// <returns>Result data with result object </returns>
		// Token: 0x06000D69 RID: 3433 RVA: 0x0004F76C File Offset: 0x0004D96C
		[HslMqttApi("ReadAddress", "")]
		public OperateResult<byte[]> Read(string[] address)
		{
			bool flag = address == null;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>("address can not be null");
			}
			else
			{
				int[] array = new int[address.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = 1;
				}
				result = this.Read(address, array);
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 批量读取多地址的数据信息，例如我可以读取两个标签的数据 "A","B[0]"， 长度为 [1, 5]，返回的是一整个的字节数组，需要自行解析<br />
		/// <b>[Authorization]</b> Read the data information of multiple addresses in batches. For example, I can read the data "A", "B[0]" of two tags, 
		/// the length is [1, 5], and the return is an entire byte array, and I need to do it myself Parsing
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <param name="length">如果是数组，就为数组长度 -&gt; In the case of arrays, the length of the array </param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result object </returns>
		// Token: 0x06000D6A RID: 3434 RVA: 0x0004F7C0 File Offset: 0x0004D9C0
		public OperateResult<byte[]> Read(string[] address, int[] length)
		{
			bool flag = address != null && address.Length > 1;
			if (flag)
			{
				bool flag2 = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
				if (flag2)
				{
					return new OperateResult<byte[]>(StringResources.Language.InsufficientPrivileges);
				}
			}
			OperateResult<byte[], ushort, bool> operateResult = this.ReadWithType(address, length);
			bool flag3 = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag3)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content1);
			}
			return result;
		}

		// Token: 0x06000D6B RID: 3435 RVA: 0x0004F830 File Offset: 0x0004DA30
		private OperateResult<byte[], ushort, bool> ReadWithType(string[] address, int[] length)
		{
			OperateResult<byte[]> operateResult = this.BuildReadCommand(address, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[], ushort, bool> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult2);
				}
				else
				{
					OperateResult operateResult3 = AllenBradleyHelper.CheckResponse(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult3);
					}
					else
					{
						result = AllenBradleyHelper.ExtractActualData(operateResult2.Content, true);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// Read Segment Data Array form plc, use address tag name
		/// </summary>
		/// <param name="address">Tag name in plc</param>
		/// <param name="startIndex">array start index, uint byte index</param>
		/// <param name="length">array length, data item length</param>
		/// <returns>Results Bytes</returns>
		// Token: 0x06000D6C RID: 3436 RVA: 0x0004F8C0 File Offset: 0x0004DAC0
		[HslMqttApi("ReadSegment", "")]
		public OperateResult<byte[]> ReadSegment(string address, int startIndex, int length)
		{
			OperateResult<byte[]> result;
			try
			{
				List<byte> list = new List<byte>();
				OperateResult<byte[]> operateResult;
				OperateResult<byte[], ushort, bool> operateResult2;
				for (;;)
				{
					operateResult = this.ReadCipFromServer(new byte[][]
					{
						AllenBradleyHelper.PackRequestReadSegment(address, startIndex, length)
					});
					bool flag = !operateResult.IsSuccess;
					if (flag)
					{
						break;
					}
					operateResult2 = AllenBradleyHelper.ExtractActualData(operateResult.Content, true);
					bool flag2 = !operateResult2.IsSuccess;
					if (flag2)
					{
						goto Block_3;
					}
					startIndex += operateResult2.Content1.Length;
					list.AddRange(operateResult2.Content1);
					bool flag3 = !operateResult2.Content3;
					if (flag3)
					{
						goto Block_4;
					}
				}
				return operateResult;
				Block_3:
				return OperateResult.CreateFailedResult<byte[]>(operateResult2);
				Block_4:
				result = OperateResult.CreateSuccessResult<byte[]>(list.ToArray());
			}
			catch (Exception ex)
			{
				result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
			}
			return result;
		}

		// Token: 0x06000D6D RID: 3437 RVA: 0x0004F99C File Offset: 0x0004DB9C
		private OperateResult<byte[]> ReadByCips(params byte[][] cips)
		{
			OperateResult<byte[]> operateResult = this.ReadCipFromServer(cips);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[], ushort, bool> operateResult2 = AllenBradleyHelper.ExtractActualData(operateResult.Content, true);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(operateResult2.Content1);
				}
			}
			return result;
		}

		/// <summary>
		/// 使用CIP报文和服务器进行核心的数据交换
		/// </summary>
		/// <param name="cips">Cip commands</param>
		/// <returns>Results Bytes</returns>
		// Token: 0x06000D6E RID: 3438 RVA: 0x0004F9F8 File Offset: 0x0004DBF8
		public OperateResult<byte[]> ReadCipFromServer(params byte[][] cips)
		{
			byte[][] array = new byte[2][];
			array[0] = new byte[4];
			int num = 1;
			byte[] portSlot;
			if ((portSlot = this.PortSlot) == null)
			{
				byte[] array2 = new byte[2];
				array2[0] = 1;
				portSlot = array2;
				array2[1] = this.Slot;
			}
			array[num] = this.PackCommandService(portSlot, Enumerable.ToArray<byte[]>(cips));
			byte[] send = AllenBradleyHelper.PackCommandSpecificData(array);
			OperateResult<byte[]> operateResult = base.ReadFromCoreServer(send);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = AllenBradleyHelper.CheckResponse(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content);
				}
			}
			return result;
		}

		/// <summary>
		/// 使用EIP报文和服务器进行核心的数据交换
		/// </summary>
		/// <param name="eip">eip commands</param>
		/// <returns>Results Bytes</returns>
		// Token: 0x06000D6F RID: 3439 RVA: 0x0004FA98 File Offset: 0x0004DC98
		public OperateResult<byte[]> ReadEipFromServer(params byte[][] eip)
		{
			byte[] send = AllenBradleyHelper.PackCommandSpecificData(eip);
			OperateResult<byte[]> operateResult = base.ReadFromCoreServer(send);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = AllenBradleyHelper.CheckResponse(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content);
				}
			}
			return result;
		}

		/// <summary>
		/// 读取单个的bool数据信息，如果读取的是单bool变量，就直接写变量名，如果是由int组成的bool数组的一个值，一律带"i="开头访问，例如"i=A[0]" <br />
		/// Read a single bool data information, if it is a single bool variable, write the variable name directly, 
		/// if it is a value of a bool array composed of int, it is always accessed with "i=" at the beginning, for example, "i=A[0]"
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result info </returns>
		// Token: 0x06000D70 RID: 3440 RVA: 0x0004FB00 File Offset: 0x0004DD00
		[HslMqttApi("ReadBool", "")]
		public override OperateResult<bool> ReadBool(string address)
		{
			bool flag = address.StartsWith("i=");
			OperateResult<bool> result;
			if (flag)
			{
				address = address.Substring(2);
				int num;
				address = AllenBradleyHelper.AnalysisArrayIndex(address, out num);
				OperateResult<bool[]> operateResult = this.ReadBoolArray(address + string.Format("[{0}]", num / 32));
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool>(operateResult);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<bool>(operateResult.Content[num % 32]);
				}
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.Read(address, 1);
				bool flag3 = !operateResult2.IsSuccess;
				if (flag3)
				{
					result = OperateResult.CreateFailedResult<bool>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<bool>(base.ByteTransform.TransBool(operateResult2.Content, 0));
				}
			}
			return result;
		}

		/// <summary>
		/// 批量读取的bool数组信息，如果你有个Bool数组变量名为 A, 那么读第0个位，可以通过 ReadBool("A")，但是第二个位需要使用 
		/// ReadBoolArray("A[0]")   // 返回32个bool长度，0-31的索引，如果我想读取32-63的位索引，就需要 ReadBoolArray("A[1]") ，以此类推。<br />
		/// For batch read bool array information, if you have a Bool array variable named A, then you can read the 0th bit through ReadBool("A"), 
		/// but the second bit needs to use ReadBoolArray("A[0]" ) // Returns the length of 32 bools, the index is 0-31, 
		/// if I want to read the bit index of 32-63, I need ReadBoolArray("A[1]"), and so on.
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result info </returns>
		// Token: 0x06000D71 RID: 3441 RVA: 0x0004FBC0 File Offset: 0x0004DDC0
		[HslMqttApi("ReadBoolArrayAddress", "")]
		public OperateResult<bool[]> ReadBoolArray(string address)
		{
			OperateResult<byte[]> operateResult = this.Read(address, 1);
			bool flag = !operateResult.IsSuccess;
			OperateResult<bool[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool[]>(operateResult);
			}
			else
			{
				result = OperateResult.CreateSuccessResult<bool[]>(base.ByteTransform.TransBool(operateResult.Content, 0, operateResult.Content.Length));
			}
			return result;
		}

		/// <summary>
		/// 读取PLC的byte类型的数据<br />
		/// Read the byte type of PLC data
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result info </returns>
		// Token: 0x06000D72 RID: 3442 RVA: 0x0001BA1E File Offset: 0x00019C1E
		[HslMqttApi("ReadByte", "")]
		public OperateResult<byte> ReadByte(string address)
		{
			return ByteTransformHelper.GetResultFromArray<byte>(this.Read(address, 1));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Read(System.String,System.UInt16)" />
		// Token: 0x06000D73 RID: 3443 RVA: 0x0004FC10 File Offset: 0x0004DE10
		[DebuggerStepThrough]
		public override Task<OperateResult<byte[]>> ReadAsync(string address, ushort length)
		{
			AllenBradleyNet.<ReadAsync>d__39 <ReadAsync>d__ = new AllenBradleyNet.<ReadAsync>d__39();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadAsync>d__39>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Read(System.String[])" />
		// Token: 0x06000D74 RID: 3444 RVA: 0x0004FC64 File Offset: 0x0004DE64
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadAsync(string[] address)
		{
			AllenBradleyNet.<ReadAsync>d__40 <ReadAsync>d__ = new AllenBradleyNet.<ReadAsync>d__40();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadAsync>d__40>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Read(System.String[],System.Int32[])" />
		// Token: 0x06000D75 RID: 3445 RVA: 0x0004FCB0 File Offset: 0x0004DEB0
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadAsync(string[] address, int[] length)
		{
			AllenBradleyNet.<ReadAsync>d__41 <ReadAsync>d__ = new AllenBradleyNet.<ReadAsync>d__41();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadAsync>d__41>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000D76 RID: 3446 RVA: 0x0004FD04 File Offset: 0x0004DF04
		[DebuggerStepThrough]
		private Task<OperateResult<byte[], ushort, bool>> ReadWithTypeAsync(string[] address, int[] length)
		{
			AllenBradleyNet.<ReadWithTypeAsync>d__42 <ReadWithTypeAsync>d__ = new AllenBradleyNet.<ReadWithTypeAsync>d__42();
			<ReadWithTypeAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[], ushort, bool>>.Create();
			<ReadWithTypeAsync>d__.<>4__this = this;
			<ReadWithTypeAsync>d__.address = address;
			<ReadWithTypeAsync>d__.length = length;
			<ReadWithTypeAsync>d__.<>1__state = -1;
			<ReadWithTypeAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadWithTypeAsync>d__42>(ref <ReadWithTypeAsync>d__);
			return <ReadWithTypeAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadSegment(System.String,System.Int32,System.Int32)" />
		// Token: 0x06000D77 RID: 3447 RVA: 0x0004FD58 File Offset: 0x0004DF58
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadSegmentAsync(string address, int startIndex, int length)
		{
			AllenBradleyNet.<ReadSegmentAsync>d__43 <ReadSegmentAsync>d__ = new AllenBradleyNet.<ReadSegmentAsync>d__43();
			<ReadSegmentAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadSegmentAsync>d__.<>4__this = this;
			<ReadSegmentAsync>d__.address = address;
			<ReadSegmentAsync>d__.startIndex = startIndex;
			<ReadSegmentAsync>d__.length = length;
			<ReadSegmentAsync>d__.<>1__state = -1;
			<ReadSegmentAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadSegmentAsync>d__43>(ref <ReadSegmentAsync>d__);
			return <ReadSegmentAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadCipFromServer(System.Byte[][])" />
		// Token: 0x06000D78 RID: 3448 RVA: 0x0004FDB4 File Offset: 0x0004DFB4
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadCipFromServerAsync(params byte[][] cips)
		{
			AllenBradleyNet.<ReadCipFromServerAsync>d__44 <ReadCipFromServerAsync>d__ = new AllenBradleyNet.<ReadCipFromServerAsync>d__44();
			<ReadCipFromServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadCipFromServerAsync>d__.<>4__this = this;
			<ReadCipFromServerAsync>d__.cips = cips;
			<ReadCipFromServerAsync>d__.<>1__state = -1;
			<ReadCipFromServerAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadCipFromServerAsync>d__44>(ref <ReadCipFromServerAsync>d__);
			return <ReadCipFromServerAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadEipFromServer(System.Byte[][])" />
		// Token: 0x06000D79 RID: 3449 RVA: 0x0004FE00 File Offset: 0x0004E000
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadEipFromServerAsync(params byte[][] eip)
		{
			AllenBradleyNet.<ReadEipFromServerAsync>d__45 <ReadEipFromServerAsync>d__ = new AllenBradleyNet.<ReadEipFromServerAsync>d__45();
			<ReadEipFromServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadEipFromServerAsync>d__.<>4__this = this;
			<ReadEipFromServerAsync>d__.eip = eip;
			<ReadEipFromServerAsync>d__.<>1__state = -1;
			<ReadEipFromServerAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadEipFromServerAsync>d__45>(ref <ReadEipFromServerAsync>d__);
			return <ReadEipFromServerAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadBool(System.String)" />
		// Token: 0x06000D7A RID: 3450 RVA: 0x0004FE4C File Offset: 0x0004E04C
		[DebuggerStepThrough]
		public override Task<OperateResult<bool>> ReadBoolAsync(string address)
		{
			AllenBradleyNet.<ReadBoolAsync>d__46 <ReadBoolAsync>d__ = new AllenBradleyNet.<ReadBoolAsync>d__46();
			<ReadBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool>>.Create();
			<ReadBoolAsync>d__.<>4__this = this;
			<ReadBoolAsync>d__.address = address;
			<ReadBoolAsync>d__.<>1__state = -1;
			<ReadBoolAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadBoolAsync>d__46>(ref <ReadBoolAsync>d__);
			return <ReadBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadBoolArray(System.String)" />
		// Token: 0x06000D7B RID: 3451 RVA: 0x0004FE98 File Offset: 0x0004E098
		[DebuggerStepThrough]
		public Task<OperateResult<bool[]>> ReadBoolArrayAsync(string address)
		{
			AllenBradleyNet.<ReadBoolArrayAsync>d__47 <ReadBoolArrayAsync>d__ = new AllenBradleyNet.<ReadBoolArrayAsync>d__47();
			<ReadBoolArrayAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool[]>>.Create();
			<ReadBoolArrayAsync>d__.<>4__this = this;
			<ReadBoolArrayAsync>d__.address = address;
			<ReadBoolArrayAsync>d__.<>1__state = -1;
			<ReadBoolArrayAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadBoolArrayAsync>d__47>(ref <ReadBoolArrayAsync>d__);
			return <ReadBoolArrayAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadByte(System.String)" />
		// Token: 0x06000D7C RID: 3452 RVA: 0x0004FEE4 File Offset: 0x0004E0E4
		[DebuggerStepThrough]
		public Task<OperateResult<byte>> ReadByteAsync(string address)
		{
			AllenBradleyNet.<ReadByteAsync>d__48 <ReadByteAsync>d__ = new AllenBradleyNet.<ReadByteAsync>d__48();
			<ReadByteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte>>.Create();
			<ReadByteAsync>d__.<>4__this = this;
			<ReadByteAsync>d__.address = address;
			<ReadByteAsync>d__.<>1__state = -1;
			<ReadByteAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadByteAsync>d__48>(ref <ReadByteAsync>d__);
			return <ReadByteAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 枚举当前的所有的变量名字，包含结构体信息，除去系统自带的名称数据信息<br />
		/// Enumerate all the current variable names, including structure information, except the name data information that comes with the system
		/// </summary>
		/// <returns>结果对象</returns>
		// Token: 0x06000D7D RID: 3453 RVA: 0x0004FF30 File Offset: 0x0004E130
		public OperateResult<AbTagItem[]> TagEnumerator()
		{
			List<AbTagItem> list = new List<AbTagItem>();
			ushort startInstance = 0;
			OperateResult<byte[]> operateResult;
			OperateResult<byte[], ushort, bool> operateResult2;
			for (;;)
			{
				operateResult = this.ReadCipFromServer(new byte[][]
				{
					AllenBradleyHelper.GetEnumeratorCommand(startInstance)
				});
				bool flag = !operateResult.IsSuccess;
				if (flag)
				{
					break;
				}
				operateResult2 = AllenBradleyHelper.ExtractActualData(operateResult.Content, true);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					goto Block_2;
				}
				bool flag3 = operateResult.Content.Length >= 43 && BitConverter.ToUInt16(operateResult.Content, 40) == 213;
				if (!flag3)
				{
					goto IL_198;
				}
				int i = 44;
				while (i < operateResult.Content.Length)
				{
					AbTagItem abTagItem = new AbTagItem();
					abTagItem.InstanceID = BitConverter.ToUInt32(operateResult.Content, i);
					startInstance = (ushort)(abTagItem.InstanceID + 1U);
					i += 4;
					ushort num = BitConverter.ToUInt16(operateResult.Content, i);
					i += 2;
					abTagItem.Name = Encoding.ASCII.GetString(operateResult.Content, i, (int)num);
					i += (int)num;
					abTagItem.SymbolType = BitConverter.ToUInt16(operateResult.Content, i);
					i += 2;
					bool flag4 = (abTagItem.SymbolType & 4096) != 4096;
					if (flag4)
					{
						bool flag5 = !abTagItem.Name.StartsWith("__");
						if (flag5)
						{
							list.Add(abTagItem);
						}
					}
				}
				bool flag6 = !operateResult2.Content3;
				if (flag6)
				{
					goto Block_8;
				}
			}
			return OperateResult.CreateFailedResult<AbTagItem[]>(operateResult);
			Block_2:
			return OperateResult.CreateFailedResult<AbTagItem[]>(operateResult2);
			Block_8:
			return OperateResult.CreateSuccessResult<AbTagItem[]>(list.ToArray());
			IL_198:
			return new OperateResult<AbTagItem[]>(StringResources.Language.UnknownError);
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.TagEnumerator" />
		// Token: 0x06000D7E RID: 3454 RVA: 0x000500F4 File Offset: 0x0004E2F4
		[DebuggerStepThrough]
		public Task<OperateResult<AbTagItem[]>> TagEnumeratorAsync()
		{
			AllenBradleyNet.<TagEnumeratorAsync>d__50 <TagEnumeratorAsync>d__ = new AllenBradleyNet.<TagEnumeratorAsync>d__50();
			<TagEnumeratorAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<AbTagItem[]>>.Create();
			<TagEnumeratorAsync>d__.<>4__this = this;
			<TagEnumeratorAsync>d__.<>1__state = -1;
			<TagEnumeratorAsync>d__.<>t__builder.Start<AllenBradleyNet.<TagEnumeratorAsync>d__50>(ref <TagEnumeratorAsync>d__);
			return <TagEnumeratorAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 枚举结构体的方法
		/// </summary>
		/// <param name="structTag">结构体的标签</param>
		/// <returns>是否成功</returns>
		// Token: 0x06000D7F RID: 3455 RVA: 0x00050138 File Offset: 0x0004E338
		[Obsolete("未测试通过")]
		public OperateResult<AbTagItem[]> StructTagEnumerator(AbTagItem structTag)
		{
			OperateResult<AbStructHandle> operateResult = this.ReadTagStructHandle(structTag);
			bool flag = !operateResult.IsSuccess;
			OperateResult<AbTagItem[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<AbTagItem[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadCipFromServer(new byte[][]
				{
					AllenBradleyHelper.GetStructItemNameType(structTag.SymbolType, operateResult.Content)
				});
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<AbTagItem[]>(operateResult2);
				}
				else
				{
					bool flag3 = operateResult2.Content.Length >= 43 && operateResult2.Content[40] == 204 && operateResult2.Content[41] == 0;
					if (flag3)
					{
						byte[] bytes = BitConverter.GetBytes(structTag.SymbolType);
						bytes[1] = (bytes[1] & 15);
						bool flag4 = bytes[1] >= 15;
						if (flag4)
						{
							result = OperateResult.CreateSuccessResult<AbTagItem[]>(this.EnumSysStructItemType(operateResult2.Content, operateResult.Content).ToArray());
						}
						else
						{
							result = OperateResult.CreateSuccessResult<AbTagItem[]>(this.EnumUserStructItemType(operateResult2.Content, operateResult.Content).ToArray());
						}
					}
					else
					{
						result = new OperateResult<AbTagItem[]>(StringResources.Language.UnknownError);
					}
				}
			}
			return result;
		}

		// Token: 0x06000D80 RID: 3456 RVA: 0x00050250 File Offset: 0x0004E450
		private OperateResult<AbStructHandle> ReadTagStructHandle(AbTagItem structTag)
		{
			OperateResult<byte[]> operateResult = this.ReadByCips(new byte[][]
			{
				AllenBradleyHelper.GetStructHandleCommand(structTag.SymbolType)
			});
			bool flag = !operateResult.IsSuccess;
			OperateResult<AbStructHandle> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<AbStructHandle>(operateResult);
			}
			else
			{
				bool flag2 = operateResult.Content.Length >= 43 && BitConverter.ToInt32(operateResult.Content, 40) == 131;
				if (flag2)
				{
					result = OperateResult.CreateSuccessResult<AbStructHandle>(new AbStructHandle
					{
						Count = BitConverter.ToUInt16(operateResult.Content, 44),
						TemplateObjectDefinitionSize = BitConverter.ToUInt32(operateResult.Content, 50),
						TemplateStructureSize = BitConverter.ToUInt32(operateResult.Content, 58),
						MemberCount = BitConverter.ToUInt16(operateResult.Content, 66),
						StructureHandle = BitConverter.ToUInt16(operateResult.Content, 72)
					});
				}
				else
				{
					result = new OperateResult<AbStructHandle>(StringResources.Language.UnknownError);
				}
			}
			return result;
		}

		// Token: 0x06000D81 RID: 3457 RVA: 0x00050348 File Offset: 0x0004E548
		private List<AbTagItem> EnumSysStructItemType(byte[] Struct_Item_Type_buff, AbStructHandle structHandle)
		{
			List<AbTagItem> list = new List<AbTagItem>();
			bool flag = Struct_Item_Type_buff.Length > 41 && Struct_Item_Type_buff[40] == 204 && Struct_Item_Type_buff[41] == 0 && Struct_Item_Type_buff[42] == 0;
			if (flag)
			{
				int num = Struct_Item_Type_buff.Length - 40;
				byte[] array = new byte[num - 4];
				Array.Copy(Struct_Item_Type_buff, 44, array, 0, num - 4);
				byte[] array2 = new byte[(int)(structHandle.MemberCount * 8)];
				Array.Copy(array, 0, array2, 0, (int)(structHandle.MemberCount * 8));
				byte[] array3 = new byte[array.Length - array2.Length + 1];
				Array.Copy(array, array2.Length - 1, array3, 0, array.Length - array2.Length + 1);
				ushort memberCount = structHandle.MemberCount;
				for (int i = 0; i < (int)memberCount; i++)
				{
					list.Add(new AbTagItem
					{
						SymbolType = BitConverter.ToUInt16(array2, 8 * i + 2)
					});
				}
				List<int> list2 = new List<int>();
				for (int j = 0; j < array3.Length; j++)
				{
					bool flag2 = array3[j] == 0;
					if (flag2)
					{
						list2.Add(j);
					}
				}
				list2.Add(array3.Length);
				for (int k = 0; k < list2.Count; k++)
				{
					bool flag3 = k == 0;
					if (!flag3)
					{
						bool flag4 = k + 1 < list2.Count;
						int num2;
						if (flag4)
						{
							num2 = list2[k + 1] - list2[k] - 1;
						}
						else
						{
							num2 = 0;
						}
						bool flag5 = num2 > 0;
						if (flag5)
						{
							list[k - 1].Name = Encoding.ASCII.GetString(array3, list2[k] + 1, num2);
						}
					}
				}
			}
			return list;
		}

		// Token: 0x06000D82 RID: 3458 RVA: 0x00050520 File Offset: 0x0004E720
		private List<AbTagItem> EnumUserStructItemType(byte[] Struct_Item_Type_buff, AbStructHandle structHandle)
		{
			List<AbTagItem> list = new List<AbTagItem>();
			bool flag = false;
			int num = 0;
			bool flag2 = Struct_Item_Type_buff.Length > 41 & Struct_Item_Type_buff[40] == 204 & Struct_Item_Type_buff[41] == 0 & Struct_Item_Type_buff[42] == 0;
			if (flag2)
			{
				int num2 = Struct_Item_Type_buff.Length - 40;
				byte[] array = new byte[num2 - 4];
				Array.ConstrainedCopy(Struct_Item_Type_buff, 44, array, 0, num2 - 4);
				for (int i = 0; i < array.Length; i++)
				{
					bool flag3 = array[i] == 0 & !flag;
					if (flag3)
					{
						num = i;
					}
					bool flag4 = array[i] == 59 && array[i + 1] == 110;
					if (flag4)
					{
						int num3 = i - num - 1;
						byte[] destinationArray = new byte[num3];
						Array.Copy(array, num + 1, destinationArray, 0, num3);
						byte[] array2 = new byte[i + 1];
						Array.Copy(array, 0, array2, 0, i + 1);
						byte[] array3 = new byte[array.Length - i - 1];
						Array.Copy(array, i + 1, array3, 0, array.Length - i - 1);
						bool flag5 = (num + 1) % 8 == 0;
						if (flag5)
						{
							int num4 = (num + 1) / 8 - 1;
							for (int j = 0; j <= num4; j++)
							{
								list.Add(new AbTagItem
								{
									SymbolType = BitConverter.ToUInt16(array2, 8 * j + 2)
								});
							}
							List<int> list2 = new List<int>();
							for (int k = 0; k < array3.Length; k++)
							{
								bool flag6 = array3[k] == 0;
								if (flag6)
								{
									list2.Add(k);
								}
							}
							list2.Add(array3.Length);
							for (int l = 0; l < list2.Count; l++)
							{
								bool flag7 = l + 1 < list2.Count;
								int num5;
								if (flag7)
								{
									num5 = list2[l + 1] - list2[l] - 1;
								}
								else
								{
									num5 = 0;
								}
								bool flag8 = num5 > 0;
								if (flag8)
								{
									list[l].Name = Encoding.ASCII.GetString(array3, list2[l] + 1, num5);
								}
							}
						}
						break;
					}
				}
			}
			return list;
		}

		/// <inheritdoc />
		// Token: 0x06000D83 RID: 3459 RVA: 0x00050774 File Offset: 0x0004E974
		[HslMqttApi("ReadInt16Array", "")]
		public override OperateResult<short[]> ReadInt16(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<short[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt16(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D84 RID: 3460 RVA: 0x000507B4 File Offset: 0x0004E9B4
		[HslMqttApi("ReadUInt16Array", "")]
		public override OperateResult<ushort[]> ReadUInt16(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<ushort[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt16(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D85 RID: 3461 RVA: 0x000507F4 File Offset: 0x0004E9F4
		[HslMqttApi("ReadInt32Array", "")]
		public override OperateResult<int[]> ReadInt32(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<int[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt32(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D86 RID: 3462 RVA: 0x00050834 File Offset: 0x0004EA34
		[HslMqttApi("ReadUInt32Array", "")]
		public override OperateResult<uint[]> ReadUInt32(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<uint[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt32(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D87 RID: 3463 RVA: 0x00050874 File Offset: 0x0004EA74
		[HslMqttApi("ReadFloatArray", "")]
		public override OperateResult<float[]> ReadFloat(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<float[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransSingle(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D88 RID: 3464 RVA: 0x000508B4 File Offset: 0x0004EAB4
		[HslMqttApi("ReadInt64Array", "")]
		public override OperateResult<long[]> ReadInt64(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<long[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt64(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D89 RID: 3465 RVA: 0x000508F4 File Offset: 0x0004EAF4
		[HslMqttApi("ReadUInt64Array", "")]
		public override OperateResult<ulong[]> ReadUInt64(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<ulong[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt64(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D8A RID: 3466 RVA: 0x00050934 File Offset: 0x0004EB34
		[HslMqttApi("ReadDoubleArray", "")]
		public override OperateResult<double[]> ReadDouble(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<double[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransDouble(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000D8B RID: 3467 RVA: 0x00050973 File Offset: 0x0004EB73
		public OperateResult<string> ReadString(string address)
		{
			return this.ReadString(address, 1, Encoding.ASCII);
		}

		/// <inheritdoc />
		// Token: 0x06000D8C RID: 3468 RVA: 0x00050984 File Offset: 0x0004EB84
		public override OperateResult<string> ReadString(string address, ushort length, Encoding encoding)
		{
			OperateResult<byte[]> operateResult = this.Read(address, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<string>(operateResult);
			}
			else
			{
				try
				{
					bool flag2 = operateResult.Content.Length >= 6;
					if (flag2)
					{
						int count = base.ByteTransform.TransInt32(operateResult.Content, 2);
						result = OperateResult.CreateSuccessResult<string>(encoding.GetString(operateResult.Content, 6, count));
					}
					else
					{
						result = OperateResult.CreateSuccessResult<string>(encoding.GetString(operateResult.Content));
					}
				}
				catch (Exception ex)
				{
					result = new OperateResult<string>(ex.Message + " Source: " + operateResult.Content.ToHexString(' '));
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x06000D8D RID: 3469 RVA: 0x00050A40 File Offset: 0x0004EC40
		[DebuggerStepThrough]
		public override Task<OperateResult<short[]>> ReadInt16Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadInt16Async>d__65 <ReadInt16Async>d__ = new AllenBradleyNet.<ReadInt16Async>d__65();
			<ReadInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<short[]>>.Create();
			<ReadInt16Async>d__.<>4__this = this;
			<ReadInt16Async>d__.address = address;
			<ReadInt16Async>d__.length = length;
			<ReadInt16Async>d__.<>1__state = -1;
			<ReadInt16Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadInt16Async>d__65>(ref <ReadInt16Async>d__);
			return <ReadInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D8E RID: 3470 RVA: 0x00050A94 File Offset: 0x0004EC94
		[DebuggerStepThrough]
		public override Task<OperateResult<ushort[]>> ReadUInt16Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadUInt16Async>d__66 <ReadUInt16Async>d__ = new AllenBradleyNet.<ReadUInt16Async>d__66();
			<ReadUInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<ushort[]>>.Create();
			<ReadUInt16Async>d__.<>4__this = this;
			<ReadUInt16Async>d__.address = address;
			<ReadUInt16Async>d__.length = length;
			<ReadUInt16Async>d__.<>1__state = -1;
			<ReadUInt16Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadUInt16Async>d__66>(ref <ReadUInt16Async>d__);
			return <ReadUInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D8F RID: 3471 RVA: 0x00050AE8 File Offset: 0x0004ECE8
		[DebuggerStepThrough]
		public override Task<OperateResult<int[]>> ReadInt32Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadInt32Async>d__67 <ReadInt32Async>d__ = new AllenBradleyNet.<ReadInt32Async>d__67();
			<ReadInt32Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<int[]>>.Create();
			<ReadInt32Async>d__.<>4__this = this;
			<ReadInt32Async>d__.address = address;
			<ReadInt32Async>d__.length = length;
			<ReadInt32Async>d__.<>1__state = -1;
			<ReadInt32Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadInt32Async>d__67>(ref <ReadInt32Async>d__);
			return <ReadInt32Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D90 RID: 3472 RVA: 0x00050B3C File Offset: 0x0004ED3C
		[DebuggerStepThrough]
		public override Task<OperateResult<uint[]>> ReadUInt32Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadUInt32Async>d__68 <ReadUInt32Async>d__ = new AllenBradleyNet.<ReadUInt32Async>d__68();
			<ReadUInt32Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<uint[]>>.Create();
			<ReadUInt32Async>d__.<>4__this = this;
			<ReadUInt32Async>d__.address = address;
			<ReadUInt32Async>d__.length = length;
			<ReadUInt32Async>d__.<>1__state = -1;
			<ReadUInt32Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadUInt32Async>d__68>(ref <ReadUInt32Async>d__);
			return <ReadUInt32Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D91 RID: 3473 RVA: 0x00050B90 File Offset: 0x0004ED90
		[DebuggerStepThrough]
		public override Task<OperateResult<float[]>> ReadFloatAsync(string address, ushort length)
		{
			AllenBradleyNet.<ReadFloatAsync>d__69 <ReadFloatAsync>d__ = new AllenBradleyNet.<ReadFloatAsync>d__69();
			<ReadFloatAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<float[]>>.Create();
			<ReadFloatAsync>d__.<>4__this = this;
			<ReadFloatAsync>d__.address = address;
			<ReadFloatAsync>d__.length = length;
			<ReadFloatAsync>d__.<>1__state = -1;
			<ReadFloatAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadFloatAsync>d__69>(ref <ReadFloatAsync>d__);
			return <ReadFloatAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D92 RID: 3474 RVA: 0x00050BE4 File Offset: 0x0004EDE4
		[DebuggerStepThrough]
		public override Task<OperateResult<long[]>> ReadInt64Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadInt64Async>d__70 <ReadInt64Async>d__ = new AllenBradleyNet.<ReadInt64Async>d__70();
			<ReadInt64Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<long[]>>.Create();
			<ReadInt64Async>d__.<>4__this = this;
			<ReadInt64Async>d__.address = address;
			<ReadInt64Async>d__.length = length;
			<ReadInt64Async>d__.<>1__state = -1;
			<ReadInt64Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadInt64Async>d__70>(ref <ReadInt64Async>d__);
			return <ReadInt64Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D93 RID: 3475 RVA: 0x00050C38 File Offset: 0x0004EE38
		[DebuggerStepThrough]
		public override Task<OperateResult<ulong[]>> ReadUInt64Async(string address, ushort length)
		{
			AllenBradleyNet.<ReadUInt64Async>d__71 <ReadUInt64Async>d__ = new AllenBradleyNet.<ReadUInt64Async>d__71();
			<ReadUInt64Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<ulong[]>>.Create();
			<ReadUInt64Async>d__.<>4__this = this;
			<ReadUInt64Async>d__.address = address;
			<ReadUInt64Async>d__.length = length;
			<ReadUInt64Async>d__.<>1__state = -1;
			<ReadUInt64Async>d__.<>t__builder.Start<AllenBradleyNet.<ReadUInt64Async>d__71>(ref <ReadUInt64Async>d__);
			return <ReadUInt64Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D94 RID: 3476 RVA: 0x00050C8C File Offset: 0x0004EE8C
		[DebuggerStepThrough]
		public override Task<OperateResult<double[]>> ReadDoubleAsync(string address, ushort length)
		{
			AllenBradleyNet.<ReadDoubleAsync>d__72 <ReadDoubleAsync>d__ = new AllenBradleyNet.<ReadDoubleAsync>d__72();
			<ReadDoubleAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<double[]>>.Create();
			<ReadDoubleAsync>d__.<>4__this = this;
			<ReadDoubleAsync>d__.address = address;
			<ReadDoubleAsync>d__.length = length;
			<ReadDoubleAsync>d__.<>1__state = -1;
			<ReadDoubleAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadDoubleAsync>d__72>(ref <ReadDoubleAsync>d__);
			return <ReadDoubleAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D95 RID: 3477 RVA: 0x00050CE0 File Offset: 0x0004EEE0
		[DebuggerStepThrough]
		public Task<OperateResult<string>> ReadStringAsync(string address)
		{
			AllenBradleyNet.<ReadStringAsync>d__73 <ReadStringAsync>d__ = new AllenBradleyNet.<ReadStringAsync>d__73();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.address = address;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadStringAsync>d__73>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D96 RID: 3478 RVA: 0x00050D2C File Offset: 0x0004EF2C
		[DebuggerStepThrough]
		public override Task<OperateResult<string>> ReadStringAsync(string address, ushort length, Encoding encoding)
		{
			AllenBradleyNet.<ReadStringAsync>d__74 <ReadStringAsync>d__ = new AllenBradleyNet.<ReadStringAsync>d__74();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.address = address;
			<ReadStringAsync>d__.length = length;
			<ReadStringAsync>d__.encoding = encoding;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<AllenBradleyNet.<ReadStringAsync>d__74>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 当前的PLC不支持该功能，需要调用 <see cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" /> 方法来实现。<br />
		/// The current PLC does not support this function, you need to call the <see cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" /> method to achieve it.
		/// </summary>
		/// <param name="address">地址</param>
		/// <param name="value">值</param>
		/// <returns>写入结果值</returns>
		// Token: 0x06000D97 RID: 3479 RVA: 0x00026127 File Offset: 0x00024327
		[HslMqttApi("WriteByteArray", "")]
		public override OperateResult Write(string address, byte[] value)
		{
			return new OperateResult(StringResources.Language.NotSupportedFunction + " Please refer to use WriteTag instead ");
		}

		/// <summary>
		/// 使用指定的类型写入指定的节点数据<br />
		/// Writes the specified node data with the specified type
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <param name="typeCode">类型代码，详细参见<see cref="T:HslCommunication.Profinet.AllenBradley.AllenBradleyHelper" />上的常用字段 -&gt;  Type code, see the commonly used Fields section on the <see cref="T:HslCommunication.Profinet.AllenBradley.AllenBradleyHelper" /> in detail</param>
		/// <param name="value">实际的数据值 -&gt; The actual data value </param>
		/// <param name="length">如果节点是数组，就是数组长度 -&gt; If the node is an array, it is the array length </param>
		/// <returns>是否写入成功 -&gt; Whether to write successfully</returns>
		// Token: 0x06000D98 RID: 3480 RVA: 0x00050D88 File Offset: 0x0004EF88
		public virtual OperateResult WriteTag(string address, ushort typeCode, byte[] value, int length = 1)
		{
			OperateResult<byte[]> operateResult = this.BuildWriteCommand(address, typeCode, value, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					OperateResult operateResult3 = AllenBradleyHelper.CheckResponse(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[]>(operateResult3);
					}
					else
					{
						result = AllenBradleyHelper.ExtractActualData(operateResult2.Content, false);
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Byte[])" />
		// Token: 0x06000D99 RID: 3481 RVA: 0x00050E0C File Offset: 0x0004F00C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, byte[] value)
		{
			AllenBradleyNet.<WriteAsync>d__77 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__77();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__77>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" />
		// Token: 0x06000D9A RID: 3482 RVA: 0x00050E60 File Offset: 0x0004F060
		[DebuggerStepThrough]
		public virtual Task<OperateResult> WriteTagAsync(string address, ushort typeCode, byte[] value, int length = 1)
		{
			AllenBradleyNet.<WriteTagAsync>d__78 <WriteTagAsync>d__ = new AllenBradleyNet.<WriteTagAsync>d__78();
			<WriteTagAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteTagAsync>d__.<>4__this = this;
			<WriteTagAsync>d__.address = address;
			<WriteTagAsync>d__.typeCode = typeCode;
			<WriteTagAsync>d__.value = value;
			<WriteTagAsync>d__.length = length;
			<WriteTagAsync>d__.<>1__state = -1;
			<WriteTagAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteTagAsync>d__78>(ref <WriteTagAsync>d__);
			return <WriteTagAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000D9B RID: 3483 RVA: 0x00050EC1 File Offset: 0x0004F0C1
		[HslMqttApi("WriteInt16Array", "")]
		public override OperateResult Write(string address, short[] values)
		{
			return this.WriteTag(address, 195, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000D9C RID: 3484 RVA: 0x00050EDE File Offset: 0x0004F0DE
		[HslMqttApi("WriteUInt16Array", "")]
		public override OperateResult Write(string address, ushort[] values)
		{
			return this.WriteTag(address, 199, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000D9D RID: 3485 RVA: 0x00050EFB File Offset: 0x0004F0FB
		[HslMqttApi("WriteInt32Array", "")]
		public override OperateResult Write(string address, int[] values)
		{
			return this.WriteTag(address, 196, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000D9E RID: 3486 RVA: 0x00050F18 File Offset: 0x0004F118
		[HslMqttApi("WriteUInt32Array", "")]
		public override OperateResult Write(string address, uint[] values)
		{
			return this.WriteTag(address, 200, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000D9F RID: 3487 RVA: 0x00050F35 File Offset: 0x0004F135
		[HslMqttApi("WriteFloatArray", "")]
		public override OperateResult Write(string address, float[] values)
		{
			return this.WriteTag(address, 202, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000DA0 RID: 3488 RVA: 0x00050F52 File Offset: 0x0004F152
		[HslMqttApi("WriteInt64Array", "")]
		public override OperateResult Write(string address, long[] values)
		{
			return this.WriteTag(address, 197, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000DA1 RID: 3489 RVA: 0x00050F6F File Offset: 0x0004F16F
		[HslMqttApi("WriteUInt64Array", "")]
		public override OperateResult Write(string address, ulong[] values)
		{
			return this.WriteTag(address, 201, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000DA2 RID: 3490 RVA: 0x00050F8C File Offset: 0x0004F18C
		[HslMqttApi("WriteDoubleArray", "")]
		public override OperateResult Write(string address, double[] values)
		{
			return this.WriteTag(address, 203, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000DA3 RID: 3491 RVA: 0x00050FAC File Offset: 0x0004F1AC
		[HslMqttApi("WriteString", "")]
		public override OperateResult Write(string address, string value)
		{
			bool flag = string.IsNullOrEmpty(value);
			if (flag)
			{
				value = string.Empty;
			}
			byte[] bytes = Encoding.ASCII.GetBytes(value);
			OperateResult operateResult = base.Write(address + ".LEN", bytes.Length);
			bool flag2 = !operateResult.IsSuccess;
			OperateResult result;
			if (flag2)
			{
				result = operateResult;
			}
			else
			{
				byte[] value2 = SoftBasic.ArrayExpandToLengthEven<byte>(bytes);
				result = this.WriteTag(address + ".DATA[0]", 194, value2, bytes.Length);
			}
			return result;
		}

		/// <summary>
		/// 写入单个Bool的数据信息。如果读取的是单bool变量，就直接写变量名，如果是bool数组的一个值，一律带下标访问，例如a[0]<br />
		/// Write the data information of a single Bool. If the read is a single bool variable, write the variable name directly, 
		/// if it is a value of the bool array, it will always be accessed with a subscript, such as a[0]
		/// </summary>
		/// <param name="address">标签的地址数据</param>
		/// <param name="value">bool数据值</param>
		/// <returns>是否写入成功</returns>
		// Token: 0x06000DA4 RID: 3492 RVA: 0x00051028 File Offset: 0x0004F228
		[HslMqttApi("WriteBool", "")]
		public override OperateResult Write(string address, bool value)
		{
			bool flag = Regex.IsMatch(address, "\\[[0-9]+\\]$");
			OperateResult result;
			if (flag)
			{
				OperateResult<byte[]> operateResult = this.BuildWriteCommand(address, value);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = operateResult;
				}
				else
				{
					OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						result = operateResult2;
					}
					else
					{
						OperateResult operateResult3 = AllenBradleyHelper.CheckResponse(operateResult2.Content);
						bool flag4 = !operateResult3.IsSuccess;
						if (flag4)
						{
							result = OperateResult.CreateFailedResult<byte[]>(operateResult3);
						}
						else
						{
							result = AllenBradleyHelper.ExtractActualData(operateResult2.Content, false);
						}
					}
				}
			}
			else
			{
				ushort typeCode = 193;
				byte[] value2;
				if (!value)
				{
					value2 = new byte[2];
				}
				else
				{
					byte[] array = new byte[2];
					array[0] = byte.MaxValue;
					value2 = array;
					array[1] = byte.MaxValue;
				}
				result = this.WriteTag(address, typeCode, value2, 1);
			}
			return result;
		}

		/// <summary>
		/// 写入Byte数据，返回是否写入成功<br />
		/// Write Byte data and return whether the writing is successful
		/// </summary>
		/// <param name="address">标签的地址数据</param>
		/// <param name="value">Byte数据</param>
		/// <returns>是否写入成功</returns>
		// Token: 0x06000DA5 RID: 3493 RVA: 0x000510F1 File Offset: 0x0004F2F1
		[HslMqttApi("WriteByte", "")]
		public virtual OperateResult Write(string address, byte value)
		{
			ushort typeCode = 194;
			byte[] array = new byte[2];
			array[0] = value;
			return this.WriteTag(address, typeCode, array, 1);
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Int16[])" />
		// Token: 0x06000DA6 RID: 3494 RVA: 0x0005110C File Offset: 0x0004F30C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, short[] values)
		{
			AllenBradleyNet.<WriteAsync>d__90 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__90();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__90>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.UInt16[])" />
		// Token: 0x06000DA7 RID: 3495 RVA: 0x00051160 File Offset: 0x0004F360
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, ushort[] values)
		{
			AllenBradleyNet.<WriteAsync>d__91 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__91();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__91>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Int32[])" />
		// Token: 0x06000DA8 RID: 3496 RVA: 0x000511B4 File Offset: 0x0004F3B4
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, int[] values)
		{
			AllenBradleyNet.<WriteAsync>d__92 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__92();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__92>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.UInt32[])" />
		// Token: 0x06000DA9 RID: 3497 RVA: 0x00051208 File Offset: 0x0004F408
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, uint[] values)
		{
			AllenBradleyNet.<WriteAsync>d__93 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__93();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__93>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Single[])" />
		// Token: 0x06000DAA RID: 3498 RVA: 0x0005125C File Offset: 0x0004F45C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, float[] values)
		{
			AllenBradleyNet.<WriteAsync>d__94 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__94();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__94>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Int64[])" />
		// Token: 0x06000DAB RID: 3499 RVA: 0x000512B0 File Offset: 0x0004F4B0
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, long[] values)
		{
			AllenBradleyNet.<WriteAsync>d__95 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__95();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__95>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.UInt64[])" />
		// Token: 0x06000DAC RID: 3500 RVA: 0x00051304 File Offset: 0x0004F504
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, ulong[] values)
		{
			AllenBradleyNet.<WriteAsync>d__96 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__96();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__96>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Double[])" />
		// Token: 0x06000DAD RID: 3501 RVA: 0x00051358 File Offset: 0x0004F558
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, double[] values)
		{
			AllenBradleyNet.<WriteAsync>d__97 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__97();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__97>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.String)" />
		// Token: 0x06000DAE RID: 3502 RVA: 0x000513AC File Offset: 0x0004F5AC
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, string value)
		{
			AllenBradleyNet.<WriteAsync>d__98 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__98();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__98>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Boolean)" />
		// Token: 0x06000DAF RID: 3503 RVA: 0x00051400 File Offset: 0x0004F600
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, bool value)
		{
			AllenBradleyNet.<WriteAsync>d__99 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__99();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__99>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Write(System.String,System.Byte)" />
		// Token: 0x06000DB0 RID: 3504 RVA: 0x00051454 File Offset: 0x0004F654
		[DebuggerStepThrough]
		public virtual Task<OperateResult> WriteAsync(string address, byte value)
		{
			AllenBradleyNet.<WriteAsync>d__100 <WriteAsync>d__ = new AllenBradleyNet.<WriteAsync>d__100();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<AllenBradleyNet.<WriteAsync>d__100>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyHelper.PackCommandService(System.Byte[],System.Byte[][])" />
		// Token: 0x06000DB1 RID: 3505 RVA: 0x000514A6 File Offset: 0x0004F6A6
		protected virtual byte[] PackCommandService(byte[] portSlot, params byte[][] cips)
		{
			return AllenBradleyHelper.PackCommandService(portSlot, cips);
		}

		/// <inheritdoc />
		// Token: 0x06000DB2 RID: 3506 RVA: 0x000514AF File Offset: 0x0004F6AF
		public override string ToString()
		{
			return string.Format("AllenBradleyNet[{0}:{1}]", this.IpAddress, this.Port);
		}
	}
}
